function open(p) {
	mui.openWindow(p);
}
$(function(){
	// var u = navigator.userAgent;
	// var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1;
	var server='http://localhost:8085';
	if(isAndroid){
		server='http://10.0.2.2:8085';
	}
	window.serverAddr=server;
	$.ajax({
		url : server+"/tree/view?name=%E8%8B%B1%E8%AF%AD%E5%AD%A6%E9%99%A2",
		type : "GET",
		success : function(data){
			$("#title").html(data.text);
			for(var i in data.children) {
				var text = data.children[i].text;
				var nodeId = data.children[i].id;
				var param = {url:'',id:'',extras:{nodeId:''}};
				param.url='./media-list.html';
				param.id='./media-list.html';
				param.extras.nodeId=nodeId;
				param.extras.server=window.serverAddr;
				$(".mui-table-view").append('<li class="mui-table-view-cell mui-media mui-col-xs-6"><a href="#"><img class="mui-media-object" src="./images/shuijiao.jpg"><div class="mui-media-body">'+text+'</div></a></li>');
				$(".mui-table-view").find("li").click(function(){
					open(param);
				});
			}
		},
	});
	$("#title").html("title");
});